<?php
namespace app\index\controller;
use \think\Controller;
/**
* 
*/
class Test extends Controller
{
	public function curltst(){
		$ch = curl_init();
		curl_setopt ($ch, CURLOPT_URL, "http://www.baidu.com");
		curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 0);
		// curl_setopt($ch, CURLOPT_POST, 1);
		// curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
		echo TEMP_PATH;
		$data = curl_exec ($ch);
		curl_close ($ch);

	}
	public function kongfuzi(){
		$cookie_file=tempnam(TEMP_PATH, 'cookie');
		$userName = '18214839337';
		$passWord = 'andorBVM';
		$postPara = "LoginForm[]=$userName&LoginForm[]=$passWord";
		$ch = curl_init ();
		// curl_setopt ($ch, CURLOPT_REFERER, "http://www.csair.com/ "); //模拟来源
		curl_setopt ($ch, CURLOPT_URL, "http://home.51cto.com/index");
		curl_setopt($ch,CURLOPT_HEADER, 0);
		curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 0);
		curl_setopt ($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);
		curl_setopt ($ch, CURLOPT_POSTFIELDS, $postPara);
		$data=curl_exec($ch);
		// echo $data;
		curl_close($ch);
		//----------------------------------------------
		// $url='http://home.51cto.com/home';
		// $ch=curl_init();
		// curl_setopt($ch,CURLOPT_URL, $url);
		// curl_setopt($ch, CURLOPT_HEADER, 0);
		// curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
		// curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);
		// curl_exec($ch);
		// curl_close($ch);
	}
	

}



?>